<template>
  <div class="application-container">
    <header>
      <div class="left">
        <i v-if="showHome" @click="$router.push('/home')"></i>
        <i v-if="showBack" class="back" @click="$router.go(-1)"></i>
      </div>
      <div class="center">{{ title }}</div>
      <div class="right">
        <i v-if="showNew" class="new" @click="$emit('newEvent')"></i>
      </div>
    </header>
    <main>
      <slot />
    </main>
  </div>
</template>
<script>
export default {
  props: {
    // 标题
    title: {
      type: String,
      required: true,
    },
    // 是否显示首页图标
    showHome: {
      type: Boolean,
      default: false,
    },
    // 是否显示返回图标
    showBack: {
      type: Boolean,
      default: false,
    },
    // 是否显示新增图标
    showNew: {
      type: Boolean,
      default: false,
    },
  },
};
</script>